summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2022-07-14 17:37:03 +0200
committerlat9nq <22451773+lat9nq@users.noreply.github.com>2023-06-05 21:15:11 +0200
commita40e0fdf9e287d962108731ebb515ee0fa4ee155 (patch)
treee28c860b01d818cd009c95939f5a87f2e35e3157
parenttime_zone_manager: Implement go_ahead/go_back (diff)
downloadyuzu-a40e0fdf9e287d962108731ebb515ee0fa4ee155.tar
yuzu-a40e0fdf9e287d962108731ebb515ee0fa4ee155.tar.gz
yuzu-a40e0fdf9e287d962108731ebb515ee0fa4ee155.tar.bz2
yuzu-a40e0fdf9e287d962108731ebb515ee0fa4ee155.tar.lz
yuzu-a40e0fdf9e287d962108731ebb515ee0fa4ee155.tar.xz
yuzu-a40e0fdf9e287d962108731ebb515ee0fa4ee155.tar.zst
yuzu-a40e0fdf9e287d962108731ebb515ee0fa4ee155.zip
-rw-r--r--src/core/hle/service/time/time_manager.cpp11
-rw-r--r--src/core/hle/service/time/time_manager.h2
-rw-r--r--src/core/hle/service/time/time_zone_content_manager.cpp4
-rw-r--r--src/core/hle/service/time/time_zone_manager.cpp32
-rw-r--r--src/core/hle/service/time/time_zone_manager.h8
-rw-r--r--src/core/hle/service/time/time_zone_service.cpp57
-rw-r--r--src/core/hle/service/time/time_zone_service.h3
7 files changed, 106 insertions, 11 deletions
diff --git a/src/core/hle/service/time/time_manager.cpp b/src/core/hle/service/time/time_manager.cpp
index 20012afd9..fa0fd0531 100644
--- a/src/core/hle/service/time/time_manager.cpp
+++ b/src/core/hle/service/time/time_manager.cpp
@@ -103,7 +103,7 @@ struct TimeManager::Impl final {
void SetupTimeZoneManager(std::string location_name,
Clock::SteadyClockTimePoint time_zone_updated_time_point,
- std::size_t total_location_name_count, u128 time_zone_rule_version,
+ std::vector<std::string> location_names, u128 time_zone_rule_version,
FileSys::VirtualFile& vfs_file) {
if (time_zone_content_manager.GetTimeZoneManager().SetDeviceLocationNameWithTimeZoneRule(
location_name, vfs_file) != ResultSuccess) {
@@ -113,7 +113,8 @@ struct TimeManager::Impl final {
time_zone_content_manager.GetTimeZoneManager().SetUpdatedTime(time_zone_updated_time_point);
time_zone_content_manager.GetTimeZoneManager().SetTotalLocationNameCount(
- total_location_name_count);
+ location_names.size());
+ time_zone_content_manager.GetTimeZoneManager().SetLocationNames(location_names);
time_zone_content_manager.GetTimeZoneManager().SetTimeZoneRuleVersion(
time_zone_rule_version);
time_zone_content_manager.GetTimeZoneManager().MarkAsInitialized();
@@ -283,10 +284,10 @@ void TimeManager::UpdateLocalSystemClockTime(s64 posix_time) {
void TimeManager::SetupTimeZoneManager(std::string location_name,
Clock::SteadyClockTimePoint time_zone_updated_time_point,
- std::size_t total_location_name_count,
+ std::vector<std::string> location_names,
u128 time_zone_rule_version,
FileSys::VirtualFile& vfs_file) {
- impl->SetupTimeZoneManager(location_name, time_zone_updated_time_point,
- total_location_name_count, time_zone_rule_version, vfs_file);
+ impl->SetupTimeZoneManager(location_name, time_zone_updated_time_point, location_names,
+ time_zone_rule_version, vfs_file);
}
} // namespace Service::Time
diff --git a/src/core/hle/service/time/time_manager.h b/src/core/hle/service/time/time_manager.h
index 3848da8bc..84572dbfa 100644
--- a/src/core/hle/service/time/time_manager.h
+++ b/src/core/hle/service/time/time_manager.h
@@ -61,7 +61,7 @@ public:
void SetupTimeZoneManager(std::string location_name,
Clock::SteadyClockTimePoint time_zone_updated_time_point,
- std::size_t total_location_name_count, u128 time_zone_rule_version,
+ std::vector<std::string> location_names, u128 time_zone_rule_version,
FileSys::VirtualFile& vfs_file);
private:
diff --git a/src/core/hle/service/time/time_zone_content_manager.cpp b/src/core/hle/service/time/time_zone_content_manager.cpp
index 86a5acc54..5d60be67a 100644
--- a/src/core/hle/service/time/time_zone_content_manager.cpp
+++ b/src/core/hle/service/time/time_zone_content_manager.cpp
@@ -82,8 +82,8 @@ void TimeZoneContentManager::Initialize(TimeManager& time_manager) {
GetTimeZoneInfoFile(timezone_setting, vfs_file) == ResultSuccess) {
const auto time_point{
time_manager.GetStandardSteadyClockCore().GetCurrentTimePoint(system)};
- time_manager.SetupTimeZoneManager(timezone_setting, time_point, location_name_cache.size(),
- {}, vfs_file);
+ time_manager.SetupTimeZoneManager(timezone_setting, time_point, location_name_cache, {},
+ vfs_file);
} else {
time_zone_manager.MarkAsInitialized();
}
diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp
index 805ffb902..5e507dff2 100644
--- a/src/core/hle/service/time/time_zone_manager.cpp
+++ b/src/core/hle/service/time/time_zone_manager.cpp
@@ -1076,4 +1076,36 @@ Result TimeZoneManager::GetDeviceLocationName(LocationName& value) const {
return ResultSuccess;
}
+Result TimeZoneManager::GetTotalLocationNameCount(s32& count) const {
+ if (!is_initialized) {
+ return ERROR_UNINITIALIZED_CLOCK;
+ }
+ count = static_cast<u32>(total_location_name_count);
+
+ return ResultSuccess;
+}
+
+Result TimeZoneManager::GetTimeZoneRuleVersion(u128& version) const {
+ if (!is_initialized) {
+ return ERROR_UNINITIALIZED_CLOCK;
+ }
+ version = time_zone_rule_version;
+
+ return ResultSuccess;
+}
+
+Result TimeZoneManager::LoadLocationNameList(std::vector<LocationName>& values) const {
+ if (!is_initialized) {
+ return ERROR_UNINITIALIZED_CLOCK;
+ }
+
+ for (const auto& name : total_location_names) {
+ LocationName entry{};
+ std::memcpy(entry.data(), name.c_str(), name.size());
+ values.push_back(entry);
+ }
+
+ return ResultSuccess;
+}
+
} // namespace Service::Time::TimeZone
diff --git a/src/core/hle/service/time/time_zone_manager.h b/src/core/hle/service/time/time_zone_manager.h
index 5ebd4035e..8664f28d1 100644
--- a/src/core/hle/service/time/time_zone_manager.h
+++ b/src/core/hle/service/time/time_zone_manager.h
@@ -21,6 +21,10 @@ public:
total_location_name_count = value;
}
+ void SetLocationNames(std::vector<std::string> location_names) {
+ total_location_names = location_names;
+ }
+
void SetTimeZoneRuleVersion(const u128& value) {
time_zone_rule_version = value;
}
@@ -33,6 +37,9 @@ public:
FileSys::VirtualFile& vfs_file);
Result SetUpdatedTime(const Clock::SteadyClockTimePoint& value);
Result GetDeviceLocationName(TimeZone::LocationName& value) const;
+ Result GetTotalLocationNameCount(s32& count) const;
+ Result GetTimeZoneRuleVersion(u128& version) const;
+ Result LoadLocationNameList(std::vector<TimeZone::LocationName>& values) const;
Result ToCalendarTime(const TimeZoneRule& rules, s64 time, CalendarInfo& calendar) const;
Result ToCalendarTimeWithMyRules(s64 time, CalendarInfo& calendar) const;
Result ParseTimeZoneRuleBinary(TimeZoneRule& rules, FileSys::VirtualFile& vfs_file) const;
@@ -46,6 +53,7 @@ private:
std::string device_location_name{"GMT"};
u128 time_zone_rule_version{};
std::size_t total_location_name_count{};
+ std::vector<std::string> total_location_names{};
Clock::SteadyClockTimePoint time_zone_update_time_point{
Clock::SteadyClockTimePoint::GetRandom()};
};
diff --git a/src/core/hle/service/time/time_zone_service.cpp b/src/core/hle/service/time/time_zone_service.cpp
index cda8d8343..e8273e152 100644
--- a/src/core/hle/service/time/time_zone_service.cpp
+++ b/src/core/hle/service/time/time_zone_service.cpp
@@ -15,10 +15,10 @@ ITimeZoneService::ITimeZoneService(Core::System& system_,
static const FunctionInfo functions[] = {
{0, &ITimeZoneService::GetDeviceLocationName, "GetDeviceLocationName"},
{1, nullptr, "SetDeviceLocationName"},
- {2, nullptr, "GetTotalLocationNameCount"},
- {3, nullptr, "LoadLocationNameList"},
+ {2, &ITimeZoneService::GetTotalLocationNameCount, "GetTotalLocationNameCount"},
+ {3, &ITimeZoneService::LoadLocationNameList, "LoadLocationNameList"},
{4, &ITimeZoneService::LoadTimeZoneRule, "LoadTimeZoneRule"},
- {5, nullptr, "GetTimeZoneRuleVersion"},
+ {5, &ITimeZoneService::GetTimeZoneRuleVersion, "GetTimeZoneRuleVersion"},
{6, nullptr, "GetDeviceLocationNameAndUpdatedTime"},
{100, &ITimeZoneService::ToCalendarTime, "ToCalendarTime"},
{101, &ITimeZoneService::ToCalendarTimeWithMyRule, "ToCalendarTimeWithMyRule"},
@@ -45,6 +45,57 @@ void ITimeZoneService::GetDeviceLocationName(HLERequestContext& ctx) {
rb.PushRaw(location_name);
}
+void ITimeZoneService::GetTotalLocationNameCount(HLERequestContext& ctx) {
+ LOG_DEBUG(Service_Time, "called");
+
+ s32 count{};
+ if (const Result result{
+ time_zone_content_manager.GetTimeZoneManager().GetTotalLocationNameCount(count)};
+ result != ResultSuccess) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(result);
+ return;
+ }
+
+ IPC::ResponseBuilder rb{ctx, 3};
+ rb.Push(ResultSuccess);
+ rb.Push(count);
+}
+
+void ITimeZoneService::LoadLocationNameList(HLERequestContext& ctx) {
+ LOG_DEBUG(Service_Time, "called");
+
+ std::vector<TimeZone::LocationName> location_names{};
+ if (const Result result{
+ time_zone_content_manager.GetTimeZoneManager().LoadLocationNameList(location_names)};
+ result != ResultSuccess) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(result);
+ return;
+ }
+
+ ctx.WriteBuffer(location_names);
+ IPC::ResponseBuilder rb{ctx, 3};
+ rb.Push(ResultSuccess);
+ rb.Push(static_cast<s32>(location_names.size()));
+}
+void ITimeZoneService::GetTimeZoneRuleVersion(HLERequestContext& ctx) {
+ LOG_DEBUG(Service_Time, "called");
+
+ u128 rule_version{};
+ if (const Result result{
+ time_zone_content_manager.GetTimeZoneManager().GetTimeZoneRuleVersion(rule_version)};
+ result != ResultSuccess) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(result);
+ return;
+ }
+
+ IPC::ResponseBuilder rb{ctx, 6};
+ rb.Push(ResultSuccess);
+ rb.PushRaw(rule_version);
+}
+
void ITimeZoneService::LoadTimeZoneRule(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto raw_location_name{rp.PopRaw<std::array<u8, 0x24>>()};
diff --git a/src/core/hle/service/time/time_zone_service.h b/src/core/hle/service/time/time_zone_service.h
index ea83b5714..952fcb0e2 100644
--- a/src/core/hle/service/time/time_zone_service.h
+++ b/src/core/hle/service/time/time_zone_service.h
@@ -22,6 +22,9 @@ public:
private:
void GetDeviceLocationName(HLERequestContext& ctx);
+ void GetTotalLocationNameCount(HLERequestContext& ctx);
+ void LoadLocationNameList(HLERequestContext& ctx);
+ void GetTimeZoneRuleVersion(HLERequestContext& ctx);
void LoadTimeZoneRule(HLERequestContext& ctx);
void ToCalendarTime(HLERequestContext& ctx);
void ToCalendarTimeWithMyRule(HLERequestContext& ctx);